package org.shijiagen.product.controller;

import lombok.RequiredArgsConstructor;
import org.shijiagen.param.ProductSearchParam;
import org.shijiagen.pojo.Product;
import org.shijiagen.product.service.ProductService;
import org.shijiagen.utils.R;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@RestController
@RequestMapping("product")
@RequiredArgsConstructor
public class ProductSearchController {
    private final ProductService productService;

    @GetMapping("list")
    public List<Product> allList(){
        return productService.allList();
    }

    @PostMapping("search")
    public R search(@RequestBody ProductSearchParam productSearchParam){
        return productService.search(productSearchParam);
    }
}
